/*
 * WeightedRoundRobinScheduler.h
 *
 *  Created on: 2011-05-14
 *      Author: Jagger
 */

#ifndef WEIGHTEDROUNDROBINSCHEDULER_H_
#define WEIGHTEDROUNDROBINSCHEDULER_H_

#include <AbstractScheduler.h>

class WeightedRoundRobinScheduler : public AbstractScheduler
{
protected:
	int32_t maxQueueSize;
	int32_t queuesNum;
	int32_t currentQueue;

	cPacketQueue** queues;
	double* weights;
	double* credits;

	virtual void initialize();
	~WeightedRoundRobinScheduler();

	virtual bool receivePacket(NetPacket* packet, int gateNum);

	virtual bool hasPacketsAwaitingDeparture();
	virtual NetPacket* getPacketForDeparture();

	/**
	 * Informuje czy scheduler jest jeszcze w stanie przyjmowac pakiety.
	 */
	bool canReceive(int32_t queueNum);

	void nextQueue();
};

#endif /* WEIGHTEDROUNDROBINSCHEDULER_H_ */
